import java.util.Scanner;
public class task1 {

	public static void main(String[] args) {
		
		double volume , area , total=0 , r , avg;
		int i=1;


		Scanner scanner = new Scanner(System.in);

		System.out.printf("Enter volume [cubic cm] for sphere #%d [ <= 0 to terminate]:",i);
		volume = scanner.nextDouble();

		while(volume > 0)
		{
		r = Math.cbrt((3 * volume) / (4 * Math.PI));
		area = 4 * Math.PI * Math.pow(r,2);
		total = total + area;
		System.out.printf("Sphere #%d surface area = %.1f square cm%n",i,area);
		i++;

		System.out.printf("Enter volume [cubic cm] for sphere #%d [ <= 0 to terminate]:",i);
		volume = scanner.nextDouble();
		}


		avg = total / (i-1);
		System.out.printf("The average surface area = %.1f square cm",avg);

		scanner.close();
	}

}
